/* Copyright (c) 2009-2010, Sean A.O. Harney <sharney3@gmail.com> */

#include "omf.h"

//process `main` ASL
void asl_process_main(void)
{

    EXPR_P expr = new_expr_functioncall("main", NULL);
    expr_eval(expr);
//TODO: maybe exit(retval) ?

}

void asl_process_asl(LLIST_P asl)
{
    LLIST_P walker;
    ASL_NODE_P stmt;

    if (asl != NULL)
      {
	  for (walker = asl; walker != NULL; walker = walker->next)
	    {

		if (glob.current_function_return != NULL)	// if last statement was return statement, stop processing ASL
		  {
		      //debug2_println("Returning 
		      break;	//out of for loop
		  }

		stmt = walker->element;
		stmt_process(stmt);
	    }
    } else
	debug2_printf("ASL is empty\n");

}
